<?php
class M_sosmed extends CI_Model{
 
    function __construct()
    {
        parent::__construct();
    }
    
    function input_sosmed()
    {
        $simpan_data =  array(
                        'Twitter'   => $this->input->post('twitter'),
                        'Facebook'  => $this->input->post('facebook'),
                        'Skype'     => $this->input->post('skype'),
                        'Wechat'    => $this->input->post('wechat'),
                        'Google'    => $this->input->post('google'),
                        'Instagram' => $this->input->post('instagram')
                        );
        $simpan = $this->db->insert('jb_id_sosmed', $simpan_data);
        return $simpan;
    }
    
    function edit_sosmed()
    {
        $id = $this->input->post('userid');
        $edit_data =    array(
                        'Twitter'   => $this->input->post('twitter'),
                        'Facebook'  => $this->input->post('facebook'),
                        'Skype'     => $this->input->post('skype'),
                        'Wechat'    => $this->input->post('wechat'),
                        'Google'    => $this->input->post('google'),
                        'Instagram' => $this->input->post('instagram')
                        );
        $this->db->where('user_id',$id);
        $this->db->update('jb_id_sosmed',$edit_data);
    }
    
    function get_sosmed()
    {
        $params = $this->db->get('jb_id_sosmed');
        return $params->result();
    }
}